/**
 * @计算一组成绩的平均值，并统计不及格分数的个数
 *
 * @author	 wangshikun <wangshikun2010@gmail.com>
 * @copyright	(c) 2012 wangshikun <wangshikun2010@gmail.com>
 * @license	http://www.opensource.org/licenses/mit-license.php The MIT License
 * @package	default
 * @subpackage	default
 */

#include <stdio.h>
#include <cs50.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {
	int num, grade, sum = 0, a = 0;
	float average;

	printf("请输入分数的个数：");
	scanf("%d", &num);

	for(int i=1; i<=num; i++) {

		do {
			printf("请输入第%d个成绩：", i);
			grade = GetInt();
		} while (grade <= 0 || grade > 100);

		sum += grade;

		if (grade < 65) {
			a++;
		}
	}

	average = (float)sum / num;
	
	printf("average is: %.2f \n", average);
	printf("不及格的有%d门\n", a);

	return 0;
}
